<script setup>
import { RouterView } from 'vue-router'
import MyTest from '@/components/MyTest/MyTest.vue'
import MyTest1 from '@/components/MyTest1/MyTest1.vue'
const count = ref(100)
function confirm(e) {
	console.log(e)
}

function getRefs(refs) {
	// console.log(refs)
	for (let key in refs) {
		refs[key].num += 1
	}
}
defineExpose({ count })

watch(count, (newValue, oldValue) => {
	console.log('监听')
	console.log(newValue, oldValue)
})
</script>

<template>
	<MyTest ref="test" :value="'123456'" @confirm="confirm">
		<template #detail>
			<div>我是detail</div>
		</template>
		<template #default>
			<div>我是default</div>
		</template>
		<template #test="{ item }">
			<div>{{ item }}111</div>
		</template>
	</MyTest>
	<MyTest1 ref="test1" :value="'123456789'" @confirm="confirm"></MyTest1>
	<button @click="getRefs($refs)">获取$refs</button>
	<div style="border: 1px solid red" @click="count++">{{ count }}</div>
	<RouterView />
</template>

<style lang="scss"></style>
